<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // p先改变了状态，后指定的成功的回调
        let p = new Promise((resolve, reject)=>{
            resolve('ok');
        })

        // then 指定成功和失败的回调的操作，是同步的
        //  成功和失败回到执行的时机是异步的
        p.then(value=>{
            console.log('value: ',value);
        })


        // p1 先指定成功的回调，后改变的状态
        let p1 = new Promise((resolve, reject)=>{
            setTimeout(()=>{
                resolve('ok');
            },2000);
        })
        p1.then(value=>{
            console.log('p1 value: ', value);
        })
    </script>
</body>
</html>